package com.zss.admin.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zss.admin.service.DataArchivingService;
import com.zss.pojo.DataArchiving;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("admin/dataArchiving")
public class DataArchivingController {

    @Resource
    DataArchivingService dataArchivingService;

    @RequestMapping("list/{start}/{end}")
    @ResponseBody
    public  Map<String,Object> list(@PathVariable Integer start,@PathVariable Integer end){

        IPage<DataArchiving> pagedb = new Page<DataArchiving>(start,end);
        IPage<DataArchiving> pageResult = dataArchivingService.page(pagedb);
        Map<String,Object> map = new HashMap<String,Object>();
        map.put("list",pageResult.getRecords());
        map.put("total",pageResult.getTotal());
        return map;
    }

}
